<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<head>
<jsp:include page="../common/common.jsp" />
</head>
<body class="page-header-fixed">
	<jsp:include page="../common/header.jsp" />
	<div class="clearfix"></div>
	<div class="page-container">
		<div class="page-sidebar-wrapper"><jsp:include
				page="../common/menu.jsp" /></div>
		<div class="page-content-wrapper">
			<div class="page-content">
				<div class="row">
					<div class="col-md-12">
						<!--  e  跳转到编辑页面   /fastmail/save -->
						<form class="form-horizontal form-row-seperated" id="form"
							method="post" action="${path}/fastmail/save">
							<div class="portlet box purple">
								<div class="portlet-title">
									<div class="caption">
										<i class="fa fa-shopping-cart"></i>新闻详细内容
									</div>
									<div class="actions btn-set">
										<a href="javascript:history.go(-1);" class="btn default"><i
											class="fa fa-angle-left"></i> 返回</a> <a
											href="javascript:location.reload();" class="btn green"><i
											class="fa fa-reply"></i> 重置</a>
										<button type="button" onclick="save()" class="btn blue">
											<i class="fa fa-check"></i> 保存
										</button>
									</div>
								</div>
								<div class="portlet-body">
									<div class="tabbable">
										<div class="tab-content no-space">
											<div class="tab-pane active" id="tab_general">
												<div class="form-body">
													<div class="form-group">
														<label class="col-md-2 control-label">公司名称: <span
															class="required">*</span>
														</label>
														<div class="col-md-5">
															<input type="text" id="company" name="company"
																class="form-control measure-input" datatype="*1-80"
																value="${data.company}" />
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">区域: <span
															class="required">*</span>
														</label>
														<div class="col-md-5">
															<select id="area" name="area" class="form-control">
																<option value="">请选择区域:</option>
																<option value="樊城区"
																	<c:if test="${data.area == '樊城区'}">selected</c:if>>樊城区</option>
																<option value="高新区"
																	<c:if test="${data.area == '高新区'}">selected</c:if>>高新区</option>
																<option value="襄城区"
																	<c:if test="${data.area == '襄城区'}">selected</c:if>>襄城区</option>
																<option value="襄州区"
																	<c:if test="${data.area == '襄州区'}">selected</c:if>>襄州区</option>
																<option value="老河口"
																	<c:if test="${data.area == '老河口'}">selected</c:if>>老河口</option>
																<option value="南漳"
																	<c:if test="${data.area == '南漳'}">selected</c:if>>南漳</option>
																<option value="宜城"
																	<c:if test="${data.area == '宜城'}">selected</c:if>>宜城</option>
																	<option value="枣阳"
																	<c:if test="${data.area == '枣阳'}">selected</c:if>>枣阳</option>
																<option value="保康"
																	<c:if test="${data.area == '保康'}">selected</c:if>>保康</option>
																<option value="谷城"
																	<c:if test="${data.area == '谷城'}">selected</c:if>>谷城</option>
															</select>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">品牌: <span
															class="required">*</span>
														</label>
														<div class="col-md-3">
															<!--  
                                                        <select id="pid" class="form-control" name="pid">   
                                                            <c:forEach items="${column}" var="s">
                                                                <option value="${s.id}"
                                                                        <c:if test="${data.cv.pid == s.id}">selected</c:if> >${s.value0}</option>
                                                            </c:forEach>
                                                        </select>   -->
															<!--  
                                                        <input type="text" id="brand" name="brand"
                                                               class="form-control measure-input" datatype="*1-80"
                                                               value="${data.brand}"/>  -->
															<select id="brand" name="brand" class="form-control">
																<option value="">请选择品牌:</option>
																<option value="顺丰"
																	<c:if test="${data.brand == '顺丰'}">selected</c:if>>顺丰</option>
																<option value="圆通"
																	<c:if test="${data.brand == '圆通'}">selected</c:if>>圆通</option>
																<option value="申通"
																	<c:if test="${data.brand == '申通'}">selected</c:if>>申通</option>
																<option value="中通"
																	<c:if test="${data.brand == '中通'}">selected</c:if>>中通</option>
																<option value="全一"
																	<c:if test="${data.brand == '全一'}">selected</c:if>>全一</option>
																<option value="汇通"
																	<c:if test="${data.brand == '汇通'}">selected</c:if>>汇通</option>
																<option value="韵达"
																	<c:if test="${data.brand == '韵达'}">selected</c:if>>韵达</option>
																<option value="速尔"
																	<c:if test="${data.brand == '速尔'}">selected</c:if>>速尔</option>
																<option value="优速"
																	<c:if test="${data.brand == '优速'}">selected</c:if>>优速</option>
																<option value="全峰"
																	<c:if test="${data.brand == '全峰'}">selected</c:if>>全峰</option>
																<option value="DHL"
																	<c:if test="${data.brand == 'DHL'}">selected</c:if>>DHL</option>
																<option value="择炫"
																	<c:if test="${data.brand == '择炫'}">selected</c:if>>择炫</option>
																<option value="国通"
																	<c:if test="${data.brand == '国通'}">selected</c:if>>国通</option>
																<option value="苏宁"
																	<c:if test="${data.brand == '苏宁'}">selected</c:if>>苏宁</option>
																<option value="龙邦速递"
																	<c:if test="${data.brand == '龙邦速递'}">selected</c:if>>龙邦速递</option>
																<option value="天天"
																	<c:if test="${data.brand == '天天'}">selected</c:if>>天天</option>
																<option value="快捷"
																	<c:if test="${data.brand == '快捷'}">selected</c:if>>快捷</option>
																<option value="百世汇通"
																	<c:if test="${data.brand == '百世汇通'}">selected</c:if>>百世汇通</option>
																<option value="龙邦"
																	<c:if test="${data.brand == '龙邦'}">selected</c:if>>龙邦</option>
																<option value="EMS"
																	<c:if test="${data.brand == 'EMS'}">selected</c:if>>EMS</option>
																<option value="德邦"
																	<c:if test="${data.brand == '德邦'}">selected</c:if>>德邦</option>
																	<option value="宅急送"
																	<c:if test="${data.brand == '宅急送'}">selected</c:if>>宅急送</option>
															</select>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">公司地址: <span
															class="required">*</span>
														</label>

														<div class="col-md-5">
															<input type="text" id="address" name="address"
																class="form-control measure-input" datatype="*1-80"
																value="${data.address}" />
														</div>
														<div class="col-md-5">
															&nbsp;可输入<b><span id="title_len">80</span></b> 个字符
														</div>
													</div>

													<div class="form-group">
														<label class="col-md-2 control-label">客服热线: </label>
														<div class="col-md-5">
															<input id="telephone" name="telephone" type="text"
																class="form-control tags medium"
																value="${data.telephone}" />
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">查询电话: </label>
														<!-- e  data?? -->
														<div class="col-md-5">
															<input id="queryphone" name="queryphone" type="text"
																class="form-control tags medium"
																value="${data.queryphone}" />
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">经度: <span
															class="required">*</span>
														</label>
														<!-- e  data?? -->
														<div class="col-md-5">
															<input id="lag" name="lag" type="text"
																class="form-control tags medium"
																value="${data.lag}" />
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">纬度: <span
															class="required">*</span>
														</label>
														<!-- e  data?? -->
														<div class="col-md-5">
															<input id="lat" name="lat" type="text"
																class="form-control tags medium"
																value="${data.lat}" />
														</div>
													</div>
													
													<div class="form-group">
														<label class="col-md-2 control-label">备注: </label>
														<!-- e  data?? -->
														<div class="col-md-5">
															<input id="remark" name="remark" type="text"
																class="form-control tags medium"
																value="${data.remark}" />
														</div>
													</div>

													<div class="form-group">
														<label class="col-md-2 control-label">网点描述: </label>

														<div class="col-md-8">
															<%-- <jsp:include page="common/editor.jsp" /> --%>
															<input id="context" type="hidden" name="context">
															<script id="editor" type="text/plain"
																style="height:500px;">${data.context}</script>
														</div>
													</div>
													
												</div>
											</div>
										</div>
									</div>
								</div>

								<div class="portlet-title">
									<div class="actions btn-set">
										<a href="javascript:history.go(-1);" class="btn default"><i
											class="fa fa-angle-left"></i> 返回</a> <a
											href="javascript:location.reload();" class="btn green"><i
											class="fa fa-reply"></i> 重置</a>
										<button type="button" onclick="save()" class="btn blue">
											<i class="fa fa-check"></i> 保存
										</button>
									</div>
								</div>

							</div>
							<input type="hidden" id="id" name="id" value="${data.id}">
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<jsp:include page="../common/footer.jsp" />
	<script type="text/javascript"
		src="${path}/assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/jquery.pwstrength.bootstrap/src/pwstrength.js"></script>
	<script type="text/javascript"
		src="${path}/assets/scripts/biz/ajaxfileupload.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/ueditor/ueditor.config.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/district/linkagesel-min.js"></script>

	<script>
    var operType = '${operType}';
    var editor, form;
    $(function () {
        UE.getEditor('editor');
        form = $("form").Validform({
            tiptype: function (msg, o, cssctl) {
                //msg：提示信息;
                //o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
                //cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
                if (!o.obj.is("form")) {//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
                    var objtip = o.obj.siblings(".Validform_checktip");
                    cssctl(objtip, o.type);
                    objtip.text(msg);
                } else {
                    var objtip = o.obj.find("#msgdemo");
                    cssctl(objtip, o.type);
                    objtip.text(msg);
                }
            },
            postonce: true,
            showAllError: true,
            callback: function () {
                save();
            }
        });
    });
    function save() {
    	
        var context = UE.getEditor('editor').getContent();
        /*
        if (!/[\w\W]+/.test(context)) {
            alert("内容不能为空");
            return;
        } */
        $("#context").val(context); 
        if ($("#company").val()=='') {
            alert("公司名称不能为空");
            return;
        }
        if ($("#area").val()=='') {
            alert("区域不能为空");
            return;
        }
        if ($("#brand").val()=='') {
            alert("品牌不能为空");
            return;
        }
        if ($("#address").val()=='') {
            alert("公司地址不能为空");
            return;
        }
        if ($("#lag").val()=='') {
            alert("经度不能为空");
            return;
        }
        if ($("#lat").val()=='') {
            alert("纬度不能为空");
            return;
        }
        /*
        if ($("#file").val() !== "") {
            $.ajaxFileUpload({
                url: '${path}/conf/upload',
                secureuri: false,
                fileElementId: 'file',
                dataType: 'json',
                success: function (data, status) {
                    if (data.statusCode == 200) {
                       // $("#imgUrl").val(data.uri);
                        $("#form").submit();
                    } else
                        alert(data.info+"123456");
                }
            });
        }else{
	        $("#form").submit();
        }*/
        $("#form").submit();
    }
</script>
</body>
</html>